<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="{:U($Think.ACTION_NAME)}" method="post">
        <input type="hidden" name="pageSize" value="{$Think.session.pageSize}">
        <input type="hidden" name="pageCurrent" value="{$Think.session.pageCurrent}">
        <input type="hidden" name="orderField" value="{$Think.session.orderField}">
        <input type="hidden" name="orderDirection" value="{$Think.session.orderDirection}">
        <div class="bjui-searchBar">
            <label>账号：</label><input type="text" name="search[username]" value="{$search.username}" class="form-control" size="10" />
            <label>姓名：</label><input type="text" name="search[name]" value="{$search.name}" class="form-control" size="10" />
            <button type="submit" class="btn-default" data-icon="search">查询</button>
            <div class="pull-right">
                <div class="btn-group">
                    <button type="button" class="btn-default dropdown-toggle" data-toggle="dropdown" data-icon="copy">功能操作<span class="caret"></span></button>
                    <ul class="dropdown-menu right" role="menu">
                        <li><a href="{:U('addAdmin')}" data-toggle="dialog" data-width="1000" data-height="600" data-id="dialog-mask" data-mask="true">新增数据</a></li>
                        <li><a href="{:U('del')}" data-toggle="doajaxchecked" data-confirm-msg="确定要删除选中项吗？" data-idname="ids" data-group="ids"><i class="fa fa-times"></i> 删除数据</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </form>
</div>


<div class="bjui-pageContent">
    <!-- 内容区 -->
    <table data-toggle="tablefixed" data-width="100%" data-nowrap="true">
        <thead>
            <tr>
                <volist name="tableFields" id="tvo">
                <th <if condition="$tvo.order eq 1">data-order-field="{$key}"</if>>{$tvo.name}</th>
                </volist>
                <th width="30"><input type="checkbox" class="checkboxCtrl" data-group="ids" data-toggle="icheck"></th>
                <th>操作</th>
            </tr>
        </thead>
        <volist name="list" id="vo">
            <tr aid="{$vo.aid}">
                <volist name="tableFields" id="tvo">
                    <td>{$vo.$key}</td>
                </volist>
                <td><input type="checkbox" name="ids" data-toggle="icheck" value="<?= $vo[uid]?>"></td>
                <td>
                    <!-- [ <if condition="$vo.email eq C('ADMIN_AUTH_KEY')">--
                        <else/> --><a href="__URL__/editAdmin/uid/{$vo.uid}" class="btn btn-default" data-toggle="dialog" data-id="nodeEdit" data-width="1000" data-height="600">编辑</a><!-- </if> ] -->
                    <a href="{:U('del?uid=' . $vo[uid])}" data-icon="times" title="删除内容" class="btn btn-red" data-toggle="doajax" data-confirm-msg="确定要删除选中项吗？">删除</a>
                </td>
            </tr>
        </volist>
    </table>
</div>

<include file="./App/Common/View/Common/pageFooter.html" />

<script type="text/javascript">
    //show完毕前执行
    $('#myModal').on('shown.bs.modal', function () {
        // 提交表单
        $(".submitForm").click(function() {
            var url;
            if ($("#pk").val()){
                url = '__URL__/editAdmin';
            } else {
                <if condition = "ACTION_NAME neq 'editAdmin'">
                    if (!isEmail($("#email").val())) {
                        popup.alert("账号邮件地址格式错误");
                        return false;
                    }
                    if ($.trim($("#pwd").val()) == '') {
                        popup.alert("密码不能为空");
                        return false;
                    }
                </if>
                url = '__URL__/addAdmin';
            }
            ajaxSubmit(url, '#addForm');
        });
    });       
</script>
